/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.verify.constraint;

public class PrimativeArrayDoesNotContain extends ModifiableConstraint<PrimativeArrayDoesNotContain> {
	private final Object doesNotContain;
	private final ArrayUtil arrayUtil;

	public PrimativeArrayDoesNotContain(Object doesNotContain, Modifier modifier, ArrayUtil arrayUtil) {
		super(modifier);

		this.doesNotContain = doesNotContain;
		this.arrayUtil = arrayUtil;
	}

	@Override
	public boolean evaluate(Object searchIn) {
		return searchIn == null || !arrayUtil.contains(modify(searchIn), modify(doesNotContain));
	}

	@Override
	public String describeFailureImpl() {
		return "contains <" + doesNotContain + ">";
	}
}
